package view;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import javax.swing.DefaultListModel;

public class ListModel extends DefaultListModel<File>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	
	public ListModel(List<File> files) {
		setFiles(files);
	}
	public ListModel() {
	}
	public void setFiles(List<File> files){
		int i = 0;
		for (File file : files) {
			this.add(i++, file);
		}
	}
	
	public List<File> getFiles(){
		List<File> files = new ArrayList<File>();
		for (int i = 0; i < this.getSize(); i++) {
			files.add((File) this.getElementAt(i));
		}
		return files;
	}
	
}
